<template>
  <div class="item-video-container">
    <!-- 封面布局组 -->
    <div class="img-layer-container" @click="linkHandler">
      <!-- 封面 -->
      <div class="img-container-border">
        <div class="img-container">
          <img :src="itemData.cover" class="cover">
        </div>
      </div>
      <!-- <div class="block-container">
        <div class="block" />
      </div>
      <div class="block-container block-r-container">
        <div class="block block-r" />
      </div>-->
    </div>
    <!-- 标题组 -->
    <div class="title-layer-container">
      <div class="title-body">{{ itemData.title }}</div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    itemData: {
      type: Object,
      required: false,
      default() {
        return {
          title: '默认标题',
          cover: 'https://placehold.it/1600x900'
        }
      }
    }
  },
  methods: {
    linkHandler(href) {
      const { itemData } = this
      this.$router.push({
        path: 'videoView',
        query: { title: itemData.title, url: itemData.link }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.item-video-container {
  // height: calc(100vw);
  padding: 20px 0;
  position: relative;
  .img-container-border {
    border: 5px solid #000;
    border-style: solid none;
    background-color: #000;
  }
  .img-layer-container {
    position: relative;
    box-sizing: initial;
    .img-container {
      box-sizing: initial;
      padding: 3px 0;
      border: 8px #fafafa;
      border-style: dashed none;
      border-color: #fafafa #000;
      width: 80%;
      height: calc(80vw / 1.9);
      max-height: calc(640px * 0.8 / 1.9);
      margin: auto;
      background-color: #000;
      .cover {
        width: 100%;
      }
    }
    .block-container {
      width: 100px;
      height: calc(100% - 1px);
      position: absolute;
      top: calc(50%);
      left: -20%;
      z-index: 99;
      transform: translateY(-50%);
      border: 5px solid #000;
      border-style: solid none;
      background-color: #000;
    }
    .block {
      width: 100px;
      height: calc(100% - 22px);
      box-sizing: initial;
      padding: 3px 0;
      border: 8px #fafafa;
      border-style: dashed none;
      border-color: #fafafa #000;
      background-color: #000;
    }
    .block-r-container {
      transform: translateY(180deg);
      left: initial;
      right: -20%;
    }
  }
  .title-layer-container {
    width: 100%;
    position: absolute;
    bottom: 22%;
    left: 50%;
    transform: translateX(-50%);
    font-weight: bold;
    text-shadow: 1px 1px 0px #000;
    -webkit-text-stroke: 0.3px #fff;
    font-size: 16px;
    text-align: center;
    .title-body {
      padding: 3px 5px;
      white-space: nowrap;
      display: inline-block;
      background-color: rgba(0, 0, 0, 0.3);
    }
  }
}
</style>
